<?php

use yii\helpers\Html;
use yii\widgets\LinkPager;
use yii\grid\GridView;
use yii\bootstrap\Modal;
use app\common\Functions;
/**
 * @var yii\web\View $this
 * @var amnah\yii2\user\Module $module
 * @var array $actions
 */
global $regionTypes2;
global $prodAttrCodes;
$regionTypes2 = $regionTypes;
$module = $this->context->module;


$prodAttrCodes=[];



// 增加展示的字段
$columns = [];
$i = 0;


$columns[$i]['attribute'] = 'id';
$columns[$i]['options'] = ['style'=>'width:30px'];

$i++;
//订单类型
$columns[$i]['label'] = '数据日期';
$columns[$i]['attribute'] = 'data_date';
$columns[$i]['options'] = ['style'=>'width:80px'];
$columns[$i]['value']   = function($model)
{
    return $model->data_date;
};


$i++;
//订单类型
$columns[$i]['label'] = '1735访客';
$columns[$i]['attribute'] = 'yq_day_amount';
$columns[$i]['options'] = ['style'=>'width:65px'];
$columns[$i]['value']   = function($model)
{
    return $model->yq_day_amount;
};
$i++;
//订单类型
$columns[$i]['label'] = '1735成本';
$columns[$i]['attribute'] = 'yq_day_fee';
$columns[$i]['options'] = ['style'=>'width:65px'];
$columns[$i]['value']   = function($model)
{
    return $model->yq_day_fee;
};

$i++;
//订单类型
$columns[$i]['label'] = '1735咨询量';
$columns[$i]['attribute'] = 'sq_day_amount';
$columns[$i]['options'] = ['style'=>'width:65px'];
$columns[$i]['value']   = function($model)
{
    return $model->sq_day_amount;
};
$i++;
//订单类型
$columns[$i]['label'] = '1735咨询成本';
$columns[$i]['attribute'] = 'sq_day_fee';
$columns[$i]['options'] = ['style'=>'width:65px'];
$columns[$i]['value']   = function($model)
{
    return $model->sq_day_fee;
};
$i++;
//订单类型
$columns[$i]['label'] = '1735有效咨询';
$columns[$i]['attribute'] = 'yx_day_amount';
$columns[$i]['options'] = ['style'=>'width:65px'];
$columns[$i]['value']   = function($model)
{
    return $model->yx_day_amount;
};
$i++;
//订单类型
$columns[$i]['label'] = '1735有效咨询成本';
$columns[$i]['attribute'] = 'yx_day_fee';
$columns[$i]['options'] = ['style'=>'width:65px'];
$columns[$i]['value']   = function($model)
{
    return $model->yx_day_fee;
};

$i++;
//订单类型
$columns[$i]['label'] = '淘办访客';
$columns[$i]['attribute'] = 'tb_day_amount';
$columns[$i]['options'] = ['style'=>'width:65px'];
$columns[$i]['value']   = function($model)
{
    return $model->tb_day_amount;
};
$i++;
//订单类型
$columns[$i]['label'] = '淘办成本';
$columns[$i]['attribute'] = 'tb_day_fee';
$columns[$i]['options'] = ['style'=>'width:65px'];
$columns[$i]['value']   = function($model)
{
    return $model->tb_day_fee;
};

$i++;
//订单类型
$columns[$i]['label'] = '淘办咨询量';
$columns[$i]['attribute'] = 'tbsq_day_amount';
$columns[$i]['options'] = ['style'=>'width:65px'];
$columns[$i]['value']   = function($model)
{
    return $model->tbsq_day_amount;
};
$i++;
//订单类型
$columns[$i]['label'] = '淘办咨询成本';
$columns[$i]['attribute'] = 'tbsq_day_fee';
$columns[$i]['options'] = ['style'=>'width:65px'];
$columns[$i]['value']   = function($model)
{
    return $model->tbsq_day_fee;
};
$i++;
//订单类型
$columns[$i]['label'] = '淘办有效咨询';
$columns[$i]['attribute'] = 'tbyx_day_amount';
$columns[$i]['options'] = ['style'=>'width:65px'];
$columns[$i]['value']   = function($model)
{
    return $model->tbyx_day_amount;
};
$i++;
//订单类型
$columns[$i]['label'] = '淘办有效咨询成本';
$columns[$i]['attribute'] = 'tbyx_day_fee';
$columns[$i]['options'] = ['style'=>'width:65px'];
$columns[$i]['value']   = function($model)
{
    return $model->tbyx_day_fee;
};

$i++;
//订单类型
$columns[$i]['label'] = '日外推数';
$columns[$i]['format'] = 'raw';//格式化输出
$columns[$i]['attribute'] = 'wt_day_amount';
$columns[$i]['options'] = ['style'=>'width:60px'];
$columns[$i]['value']   = function($model)
{
    return  Html::a($model->wt_day_amount, '#', ['class' => 't','data-toggle'=>'modal',
        'data-target'=>'#black-list-modal',
        'label'=>'标记', 'title' => '弹框']) ;
};
$i++;
//订单类型
$columns[$i]['label'] = '日增渠道';
$columns[$i]['attribute'] = 'qd_day_amount';
$columns[$i]['options'] = ['style'=>'width:60px'];
$columns[$i]['value']   = function($model)
{
    return $model->qd_day_amount;
};
$i++;
//订单类型
$columns[$i]['label'] = '佣金';
$columns[$i]['attribute'] = 'day_income';
$columns[$i]['options'] = ['style'=>'width:70px'];
$columns[$i]['value']   = function($model)
{
    return $model->day_income;
};
$i++;
//订单类型
$columns[$i]['label'] = '面积(㎡)';
$columns[$i]['attribute'] = 'day_area';
$columns[$i]['options'] = ['style'=>'width:75px'];
$columns[$i]['value']   = function($model)
{
    return $model->day_area;
};





        $i++;
        //操作选项
        // $columns[$i]['class']   = 'app\common\grid\ActionColumn';
        $columns[$i]['options'] = ['style'=>'width:110px'];

        $columns[$i]['content']   = function($model) use ($now_url)
        {
            $createUrlModel                     = [];
            $createUrlModel['id']            =  'activity-update-sem-link';
            $createUrlModel['class']        = 'btn btn-xs btn-warning activity-update-sem-link';
            $createUrlModel['data-toggle'] = 'modal';
            $createUrlModel['data-target'] = '#create-sem-modal';
            $createUrlModel['label'] = '网站修改';
            $createUrlModel['title'] = '网站推广数据修改';
            $createUrlModel ['data-last_url']         = $now_url;
            $createUrlModel ['data-id']         = $model->id;



            $btns = [];

            $btnBegin = Html::a( '网站修改', '#', $createUrlModel);



            $btns[]   = Html::a( '删除', ['delete', 'id'=>$model->id , 'last_url'=> $now_url], [ 'label'=>'删除', 'title' => '删除']);

            return Functions::getActionDropdownContext($btnBegin, $btns);

        };






?>

<?php
//'layout' => "{items}{summary}{pager}",
echo GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'layout' => "{items}{summary}{pager}",
    'options'=>['id'=>'grid', 'class'=>'col-sm-12'],
    'tableOptions'=>[ 'class'=>'table table-bordered table-striped dataTable'],
    'columns' => $columns,
    /*  'components' => ['formatter' => ['datetimeFormat' => 'yyyy-MM-dd HH:mm:',]]*/

]);





?>



